﻿@using Microsoft.AspNetCore.Http;
@model Mango.Web.Areas.Cms.Models.ReadViewModel
@{
    ViewData["Title"] = Model.ContentsData.Title;
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@section Style{
    <link href="~/lib/code/prism.css" rel="stylesheet" />
    <style>
        pre .comment:before,
        pre .comment:after {
            /* 1 */
            display: table;
            content: " ";
            display: none;
            /* 2 */
        }

        pre .comment:after {
            clear: both;
        }

        pre .comment:before,
        pre .comment:after {
            /* 1 */
            display: table;
            content: " ";
            display: none;
            /* 2 */
        }

        pre .comment {
            border: 0;
        }
    </style>
}
@Html.PartialAsync("~/Views/Template/Channel.cshtml", Model.ChannelListData).Result




<input type="hidden" data-id="@Model.ContentsData.ContentsId" data-title="@Model.ContentsData.Title" id="msg_posts_data" />

<div class="row">
    <div class="col-lg-9">
        <div class="my-3 p-3 bg-white rounded box-shadow">
            <h5 class="border-bottom border-gray pb-2 mb-0">@Model.ContentsData.Title</h5>
            <div class="media pt-3  border-gray ">
                <img src="@(Model.ContentsData.HeadUrl)" alt="" class="mr-2 rounded" style="width:40px;height:40px;">
                <div class="media-body pb-3 mb-0 small lh-125">
                    <h6 class="d-block">@Model.ContentsData.NickName</h6>
                    <span><img src="~/style/bootstrap/dist/icons/clock.svg" style="width:12px;height:12px;" title="发布时间" />：@Model.ContentsData.PostTime.ToString("yyyy-MM-dd HH:mm:ss")</span>

                    <span style="margin-left:10px;"><img src="~/style/bootstrap/dist/icons/eye.svg" style="width:12px;height:12px;" title="浏览次数" />：@Model.ContentsData.ReadCount</span>

                    <span style="margin-left:10px;"><img src="~/style/bootstrap/dist/icons/comment.svg" style="width:12px;height:12px;" title="回复数" />：@Model.ContentsData.AnswerCount</span>
                </div>
            </div>
            <div class="text">
                @if (Model.ContentsData.StateCode==1)
                {
                    <div style="font-size:15px;">@Html.Raw(Model.ContentsData.Contents)</div>
                }
                else
                {
                    <div class="alert alert-info">
                        <div class="content">该内容已经失联,我们在火星发现了Ta的踪迹...</div>
                    </div>
                }
            </div>

            <footer id="mfooter">
                <p class="center text" style="text-align:center">
                    <button class="btn btn-info" style="font-size:20px;" onclick="AddUserPlus(@(Model.ContentsData.ContentsId), '@(Model.ContentsData.Title)', 1, @(Model.ContentsData.AccountId), 0,$('#msg_posts_pluscount'))">
                        <img src="~/style/bootstrap/dist/icons/thumbsup.svg" style="width:20px;height:20px;margin-bottom:2px;" title="给Ta点个赞吧..." />
                        <span style="margin-left:2px;" class="badge badge-light" id="msg_posts_pluscount"> @(Model.ContentsData.PlusCount)</span>
                    </button>
                </p>
            </footer>

        </div>
    </div>
    <!--右边部分-->
    <div class="col-lg-3">
        <div class="my-3 p-3 bg-white rounded box-shadow">
            <h6 class="border-bottom border-gray pb-2 mb-0">热门话题...</h6>
            @foreach (var item in Model.HotListData)
            {
                <div class="media pt-1 border-gray ">
                    <div class="media-body pb-1 mb-0 small lh-125">
                        <a href="/cms/read/@item.ContentsId" target="_blank" style="color:black;"><span class="d-block" style="font-size:15px;">@item.Title</span></a>
                    </div>
                </div>
            }

        </div>
    </div>
</div>
@section Scripts{
    <script type="text/javascript">
        var id =@Html.ViewContext.RouteData.Values["id"];
        $(window).ready(function () {
            //重新设置所有代码块的基础样式
            //$("body").find("pre").attr("class", "pre-scrollable prettyprint linenums");
            //window.prettyPrint();
        });

    </script>
}


